package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppPersonnelAttendance;
import com.ep.modules.app.service.AppPersonnelAttendanceService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/personnel_attendance")
public class AppPersonnelAttendanceController {
    @Autowired
    private AppPersonnelAttendanceService appPersonnelAttendanceService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appPersonnelAttendanceService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppPersonnelAttendance apppersonnelattendance = appPersonnelAttendanceService.getById(id);
        return R.ok().put("apppersonnelattendance", apppersonnelattendance);
    }

    @SysLog("保存AppPersonnelAttendance")
    @PostMapping("/save")
    public R save(@RequestBody AppPersonnelAttendance apppersonnelattendance) {
        ValidatorUtils.validateEntity(apppersonnelattendance);
        appPersonnelAttendanceService.save(apppersonnelattendance);
        return R.ok();
    }

    @SysLog("修改AppPersonnelAttendance")
    @PostMapping("/update")
    public R update(@RequestBody AppPersonnelAttendance apppersonnelattendance) {
        ValidatorUtils.validateEntity(apppersonnelattendance);
        appPersonnelAttendanceService.update(apppersonnelattendance);
        return R.ok();
    }

    @SysLog("删除AppPersonnelAttendance")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appPersonnelAttendanceService.deleteBatch(ids);
        return R.ok();
    }
}